package com.tcloudit.system.api.factory;

import com.tcloudit.common.core.domain.R;
import com.tcloudit.system.api.RemoteThirdPartyService;
import com.tcloudit.system.api.domain.CamundaUserPost.UserEmailTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 邮件服务处理
 *
 * @author ruoyi
 */
@Component
public class RemoteThirdPartyFallbackFactory implements FallbackFactory<RemoteThirdPartyService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteThirdPartyFallbackFactory.class);

    @Override
    public RemoteThirdPartyService create(Throwable throwable)
    {
        log.error("第三方服务调用失败:{}", throwable.getMessage());

        return userEmailTO -> R.fail("发送邮件失败:" + throwable.getMessage());
    }
}
